# Maintainer: Antonio Rojas <arojas@archlinux.org>

pkgname=lrcalc
pkgver=2.1
pkgrel=4
pkgdesc="Littlewood-Richardson calculator"
arch=(loong64 x86_64)
url="https://math.rutgers.edu/~asbuch/lrcalc/"
license=(GPL3)
depends=(glibc)
makedepends=(python-setuptools cython)
replaces=(lrcalc1)
source=("https://math.rutgers.edu/~asbuch/lrcalc/$pkgname-$pkgver.tar.gz")
sha256sums=('996ac00e6ea8321ef09b34478f5379f613933c3254aeba624b6419b8afa5df57')

build() {
  cd $pkgname-$pkgver
  ./configure --prefix=/usr
  make

# install to a temp dir to build python bindings
  make DESTDIR="$PWD"/tmp-install install

  cd python
  export CFLAGS+=" -I${srcdir}/$pkgname-$pkgver/tmp-install/usr/include" LDFLAGS+=" -L${srcdir}/$pkgname-$pkgver/tmp-install/usr/lib"
  python setup.py build
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install

  cd python
  python setup.py install --skip-build --root="$pkgdir" --optimize=1
}
